//
//  ExampleColoredSegController.m
//  MultiSegmentControl
//
//  Created by ET|冰琳 on 16/7/4.
//  Copyright © 2016年 Ice Butterfly. All rights reserved.
//

#import "ExampleColoredSegController.h"
#import "MultiSegmentController.h"

@implementation ExampleColoredSegController

- (void)viewDidLoad{
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    NSArray *colors = @[[UIColor redColor], [UIColor orangeColor], [UIColor yellowColor], [UIColor greenColor]];
    NSMutableArray *coloredVCS = [NSMutableArray arrayWithCapacity:colors.count];
    
    for (UIColor *color in colors) {
        UIViewController *viewController = [UIViewController new];
        viewController.view.backgroundColor = color;
        [coloredVCS addObject:viewController];
    }
    
    BIMultiSegmentControl *multi = [[EqualWSegmentControl alloc] initWithFrame:CGRectMake(0, 64, [UIScreen mainScreen].bounds.size.width, 44.f) titles:@[@"red",@"orange",@"yellow",@"green"]];
    multi.backgroundColor = [UIColor redColor];
    multi.sameIgnore = true;
    multi.selectIndex = 0;
    multi.bottomlineView.hidden = NO;
    multi.backgroundColor = [UIColor whiteColor];
    [multi addVerticalLines];
    
    
    MultiSegmentController *controller = [[MultiSegmentController alloc] initWithSegmentControl:multi viewControllers:coloredVCS];
    [self addChildViewController:controller];
    [self.view addSubview:controller.view];

    [controller didMoveToParentViewController:self];
    controller.segmentLocation = MultiSegmentLocationBottom;
    
}

@end
